<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>

<title></title>
</head>
<body>
<div class="ibox-content">
	<form class="form-horizontal" id="dataform">

		<input type="hidden" name="tokenUrl" value="${tokenUrl}"> 
		<input type="hidden" name="token" value="${token}">

		<c:if test="${obj ne null }">
			<input type="hidden" name="ucId" value='<c:out value="${obj.ucId}"></c:out>'>
		</c:if>
		
		<div class="form-group">
			<label class="col-sm-2 control-label">班级<span class="red">*</span></label>
			<div class="col-sm-4">
				<select name="stuClass" id="pClass" class="form-control autoFull select2"
					data-url="${path}/admin/tabClass/showAllClass"
					data-def="${obj.stuClass }" onchange="changeStudent()"
					data-filed="claName" data-value="claId"
					datatype="*" nullmsg="班级不能为空">
					<option value="">--请选择所在班级--</option>
				</select>
				<div class="Validform_checktip"></div>
			</div>
			
			<label class="col-sm-2 control-label">学生姓名<span class="red">*</span></label>
			<div class="col-sm-4">
				<select name="sId" id="stu" class="form-control autoFull select2 autoFull2"
					data-url="${path}/admin/studentinfo/showAllStudent"
					data-def="${obj.sId }"
					data-filed="stuName" data-value="stuId"
					datatype="*" nullmsg="学生姓名不能为空">
					<option value="">--请选择学生--</option>
				</select>
				<div class="Validform_checktip"></div>
			</div>
		</div>	
			
			<%-- <label class="col-sm-2 control-label ">是否校园毕业<span class="red">*</span></label>
			<div class="col-sm-4">
				<input type="text" name="ucGraduation" value='<c:out value="${obj.ucGraduation}"></c:out>'
					class="form-control radius" datatype="*" nullmsg="不能为空，填是或否">				
				<div class="Validform_checktip"></div>
			</div> --%>
		<div class="form-group">			
			<label class="col-sm-2 control-label">领款日期<span class="red">*</span></label>
			<div class="col-sm-4">
				<input type="text"  class="form-control  datetimepicker"  maxlength="10" name="ucRdate"
					value='<fmt:formatDate value="${obj.ucRdate }" pattern='yyyy-MM-dd' />'
					datatype="*" nullmsg="日期不能为空">
				<div class="Validform_checktip"></div>					
			</div>
		
			<label class="col-sm-2 control-label ">领款人<span class="red">*</span></label>
			<div class="col-sm-4">
				<input type="text" name="ucPeople" value='<c:out value="${obj.ucPeople}"></c:out>'
					class="form-control radius" datatype="*" nullmsg="领款人不能为空">				
				<div class="Validform_checktip"></div>
			</div>
		</div>	
			
		<div class="form-group">			
			<label class="col-sm-2 control-label">领款部门 <span class="red">*</span></label>
			<div class="  col-sm-4">
				<select name="ucDept" class="form-control autoFull select2"
					data-url="${path}/admin/userinfo/queryAllDepart"
					data-def="${obj.ucDept }"
					data-filed="name" data-value="name"
					datatype="*" nullmsg="部门不能为空">
					<option value="">--请选择所属部门--</option>
				</select>
				<div class="Validform_checktip"></div>				
			</div>
			
			<label class="col-sm-2 control-label ">领款金额<span class="red">*</span></label>
			<div class="col-sm-4">
				<input type="text" name="ucMoney" value='<c:out value="${obj.ucMoney}"></c:out>'
					class="form-control radius" datatype="price" nullmsg="金额不能为空" maxlength="8">				
				<div class="Validform_checktip"></div>
			</div>
		</div>

		<div class="form-group">		
			<label class="col-sm-2 control-label">备注</label>
			<div class="col-sm-4">
				<textarea rows="6" cols="" class="form-control" name="ucRemarks" 
				 datatype="*0-20" >${obj.ucRemarks }</textarea>			
			</div>					
		</div>
		
		<div class="form-group ">
			<div class="col-sm-12 text-center">
				<a href="javascript:;" onclick="myForm.submit()" class="btn btn-success radius">保存</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<button onclick="MTools.closeForm()" class="btn btn-danger radius" type="button">取消</button>
			</div>
		</div>
		
	</form>
</div>
</body>

<script type="text/javascript">
var myForm;
	$(function(){
		//带搜索的下拉框
		$(".select2").select2({'width':'100%'});
		$(".select2").trigger("blur");
		//初始化下拉框
		MTools.autoFullSelect();
		//初始化日期控件
		MTools.ininDatetimepicker({
			listenBlur : true
		});
		
		myForm = MForm.initForm({
			invokeUrl : "${path}/admin/schoolmanage/addOrModify",
			afterSubmit : function() {
				parent.myGrid.serchData();
			},
		});	
		
		<c:if test="${obj.stuClass ne null }">
			changeStudent()
		</c:if>
					
	});
	
	function changeStudent() {
		var stuClass = $("#pClass").val();
		if (stuClass != '') {
			$("#stu").removeData("url");
			$("#stu").data("url", "${path}/admin/paymentinfo/queryStuByClass?stuClass=" + stuClass);
			$("#stu").data("filed", "stuName");
			$("#stu").data("value", "stuId");
			<c:if test="${obj ne null }">
				$("#stu").data("def", "${obj.sId }");
			</c:if>
			$("#stu").empty();
			$("#stu").append('<option value="">-- 请选择指派人--</option>');
			MTools.autoFullSelect({
				selecteder : ".autoFull2"
			});
			$(".select2").select2({
				'width' : '100%'
			})
		} 
	}
	
	$('.select2').change(function() {
		if(this.value != "") {
			$(this).parent().children('.Validform_checktip').text('');
			$(this).parent().children('.Validform_checktip').removeClass('Validform_wrong');
			$(this).parent().children('.Validform_checktip').addClass('Validform_right');
		}
	})
</script>
</body>
</html>